import request from '@/axios'

export function login(data) {
    return request({
        url: '/login',
        method: 'post',
        data
    })
}

export function thirdLogin(providerId, params) {
    return request({
        url: '/auth/' + providerId,
        method: 'get',
        params
    })
}

export function register(checkCode, data) {
    return request({
        url: '/user/register/' + checkCode,
        method: 'post',
        data
    })
}

export function getUserInfo(token) {
    return request({
        url: '/user/info',
        method: 'get',
        params: { token }
    })
}

export function getPersonalInfo(userId) {
    return request({
        url: '/user/' + userId,
        method: 'get'
    })
}

export function savePersonalInfo(data) {
    return request({
        url: '/user',
        method: 'put',
        data
    })
}

export function bindEmail(checkCode, data) {
    return request({
        url: 'user/email/' + checkCode,
        method: 'post',
        data
    })
}